#include "CLogFile.h"

#include <windows.h>
#include <shlwapi.h>

ILog *CreateFileLog(const lvString &cstrFilename)
{
	return new CLogFile(cstrFilename);
};

CLogFile::CLogFile(const lvString &cstrFilename)
{
	m_pFile = _tfopen(cstrFilename.c_str(), _S("tw"));

	lvChar _chBuffer[64];

	GetPrivateProfileString(FILELOG_CONFIGURATION_SECTION, TXT_COLOR_KEY, _S("\0"), _chBuffer, 64, FILELOG_CONFIGURATION_FILENAME);
	m_dwDefTxtColor = m_dwCurTxtColor = StrToInt(_chBuffer);

	GetPrivateProfileString(FILELOG_CONFIGURATION_SECTION, TXT_BOLD_KEY, _S("\0"), _chBuffer, 64, FILELOG_CONFIGURATION_FILENAME);
	m_bDefTxtBold = m_bCurTxtBold = StrToInt(_chBuffer) ? true : false;

	GetPrivateProfileString(FILELOG_CONFIGURATION_SECTION, TXT_ITALLIC_KEY, _S("\0"), _chBuffer, 64, FILELOG_CONFIGURATION_FILENAME);
	m_bDefTxtItallic = m_bCurTxtItallic = StrToInt(_chBuffer) ? true : false;

	GetPrivateProfileString(FILELOG_CONFIGURATION_SECTION, FONT_SIZE_KEY, _S("\0"), _chBuffer, 64, FILELOG_CONFIGURATION_FILENAME);
	m_iDefFontSize = m_iCurFontSize = StrToInt(_chBuffer);

	GetPrivateProfileString(FILELOG_CONFIGURATION_SECTION, FONT_KEY, _S("\0"), _chBuffer, 64, FILELOG_CONFIGURATION_FILENAME);
	m_strDefFont = m_strCurFont = lvString(_chBuffer);
}
CLogFile::~CLogFile()
{
	fclose(m_pFile);
}

lvVoid CLogFile::Clear()
{
}
lvVoid CLogFile::Write(const lvString &cstrText)
{
}
lvVoid CLogFile::WriteLn(const lvString &cstrText)
{
}